import { get, post } from './axios';

// 获取题库列表
export function getBankList() {
  return get('/admin/question/list')
}

//添加题库
export function addBank(data) {
  return post('/admin/question/add', data)
}

// 删除题库
export function deleteBank(id) {
  return get('/admin/question/delete/' + id)
}

// 获取题库详情
export function bankDetail(id) {
  return get('/admin/question/detail/' + id)
}

// 往题库中添加题目
export function addQuestion(data) {
  return post('/admin/question/addList', data)
}

// 往题库中删除题目
export function deleteQuestion(data) {
  return post('/admin/question/deleteList', data)
}

// 编辑题库中的题目
export function editQuestion(data) {
  return post('/admin/question/edit', data)
}

// 搜索题库
export function searchBank(id) {
  return get('/admin/question/search', {
    params: {
      _id: id
    }
  })
}

// export class FormatStr {
//   constructor(data) {
//     this.key = data._id,
//     this.question = data.question
//     this.answer = data.answer
//   }
// }
